import Order from '../../dbs/models/order'

module.exports = async (ctx) => {
  // 判断用户是否已经登陆
  if (!ctx.isAuthenticated()) {
    ctx.body = {
      code: -1,
      msg: 'please login'
    }
  } else {
    try {
      const res = await Order.find()
      if (res) {
        ctx.body = {
          code: 0,
          list: res
        }
      } else {
        ctx.body = {
          code: -1,
          list: []
        }
      }
    } catch (error) {

    }
  }
}
